package bavaria.hightech.testit;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

import bavaria.hightech.banking.BankImpl;
import bavaria.hightech.exception.MoneyLauderingException;
import bavaria.hightech.exception.NoMoneyEcxeption;
import bavaria.hightech.money.Currency;

public class IntergrationTestTransfer {
	
	private static BankImpl bankOne;
	private static BankImpl bankTwo;
	
	
	@Test
	public void createBanks(){
		
		bankOne = new BankImpl("bank1");
		bankTwo = new BankImpl("bank2");
	}
	
	@Test
	public void createConditions(){	
		
		bankOne.CreateGiroAccountCondition(500, 9);
		bankOne.CreateGiroAccountCondition(1000, 2);
		bankOne.CreateGiroAccountCondition(5000, 3);
		bankOne.ChangeGiroIntrest(16, 0.4);
		
		bankOne.CreateFixedDepositConition(1, 2.5, 0);
		bankOne.CreateFixedDepositConition(3, 3, 1);
		bankOne.CreateFixedDepositConition(12, 4, 2);
		
		bankTwo.CreateGiroAccountCondition(500, 9);
		bankTwo.CreateGiroAccountCondition(1000, 2);
		bankTwo.CreateGiroAccountCondition(5000, 3);
		bankTwo.ChangeGiroIntrest(16, 0.4);
		
		bankTwo.CreateFixedDepositConition(1, 2.5, 0);
		bankTwo.CreateFixedDepositConition(3, 3, 1);
		bankTwo.CreateFixedDepositConition(12, 4, 2);
		
	}
	
	@Test
	public void createAccount(){	
		
		bankOne.createAccount("Girokonto", "Hans Wurst", Currency.EURO, 0);
		bankOne.createAccount("Girokonto", "Rainer Zufall", Currency.EURO, 1);
		
		bankTwo.createAccount("Girokonto", "Hans Wurst", Currency.EURO, 0);
		bankTwo.createAccount("Girokonto", "Rainer Zufall", Currency.EURO, 1);
		

	}
	
	@Test
	public void tetsTransfer() throws NoMoneyEcxeption, MoneyLauderingException{
		
		bankOne.deposit(1000, 2000, Currency.EURO);
		bankOne.deposit(1001, 2000, Currency.EURO);
		
		bankTwo.deposit(1000, 2000, Currency.EURO);
		bankTwo.deposit(1001, 2000, Currency.EURO);
		
		bankOne.transfer(1000, 200, Currency.EURO, "BMW1er", 1001, "bank2");
		assertTrue(bankOne.getAccountBalance(1000)== 1800);
		assertTrue(bankTwo.getAccountBalance(1001)== 2200);
//		
//		bankTwo.transfer(1001, 300, Currency.EURO, "BMW3er", 1001, "bank1");
//		assertTrue(bankOne.getAccountBalance(1001)== 2300);
//		assertTrue(bankTwo.getAccountBalance(1001)== 1900);
		
	}
	

}
